# Format:
# loop_machines.sh {your program}
# Example:
# [IN]
# $ loop_machines.sh echo %s
# [OUT]
# $ feed-05.ap-northeast-1.aws
# $ feed-01.ap-northeast-1.aws.huobi
# $ feed-02.ap-northeast-2.aws
# $ feed-02.eu-west-1.aws
# $ feed-02.us-east-1.aws
# $ feed-05.cn-hongkong.aliyun
#

if [ "$#" -lt 1 ]; then
echo "Miss arguments.  example: bash loop_machines.sh {your program}"
exit 1
fi

machines=(
"feed-05.ap-northeast-1.aws"
"feed-01.ap-northeast-1.aws.huobi"
"feed-02.ap-northeast-2.aws"
"feed-02.eu-west-1.aws"
"feed-02.us-east-1.aws"
"feed-05.cn-hongkong.aliyun"
)

cmd="${@:1}"
for m in "${machines[@]}"
do
  $(printf "$cmd\n" $m)
done